Generating partition corresponding real address in partitioned mode supporting system

ABSTRACT

A processor supports logical partitioning of a computer system. Logical partitions isolate the real address spaces of processes executing on different processors and the hardware resources that include processors. However, this multithreaded processor system can dynamically reallocate hardware resources including the processors among logical partitions. An ultra-privileged supervisor process, called a hypervisor, regulates the logical partitions. Preferably, the processor supports hardware multithreading, each thread independently capable of being in either hypervisor, supervisor, or problem state. The processor assigns certain generated addresses to its logical partition, preferably by concatenating certain high order bits from a special register with lower order bits of the generated address. A separate range check mechanism concurrently verifies that these high order effective address bits are in fact 0, and generates an error signal if they are not. In the preferred embodiment, instruction addresses from either active or dormant threads can be pre-fetched in anticipation of execution. In the preferred embodiment, the processor supports different environments which use the hypervisor, supervisor and problem states differently.

RELATED APPLICATIONS

The present application is related to the following commonly assignedco-pending U.S. patent applications, all of which are hereinincorporated by reference:

Ser. No. 09/314,769, filed May 19, 1999, entitled Processor ResetGenerated Via Memory Access Interrupt.

Ser. No. 09/314,541, filed May 19, 1999, entitled Apparatus and Methodfor Specifying Maximum Interactive Performance in a Logical Partition ofa Computer.

Ser. No. 09/314,324, filed May 19, 1999, entitled Management of aConcurrent Use License in a Logically Partitioned Computer.

Ser. No. 09/314,214, filed May 19, 1999, entitled Logical PartitionManager and Method.

Ser. No. 09/314,187, filed May 19, 1999, entitled Event-Drivencommunications Interface for Logically Partitioned Computer now issuedU.S. Pat. No. 6,274,046.

Ser. No. 09/266,133, filed Mar. 10, 1999, entitled Instruction Cache forMultithreaded Processor now issued U.S. Pat. No. 6,161,166.

Ser. No. 08/976,533, filed Nov. 21, 1997, entitled Accessing Data from aMultiple Entry Fully Associative Cache Buffer in a Multithread DataProcessing System now issued U.S. Pat. No. 6,263,404.

Ser. No. 08/966,706, filed Nov. 10, 1997, entitled Effective-To-RealAddress Cache Managing Apparatus and Method now issued U.S. Pat. No.6,212,544.

Ser. No. 08/958,718, filed Oct. 23, 1997, entitled Altering ThreadPriorities in a Multithreaded Processor now issued U.S. Pat. No.6,212,544.

Ser. No. 08/958,716, filed Oct. 23, 1997, entitled Method and Apparatusfor Selecting Thread Switch Events in a Multithreaded Processor.

Ser. No. 08/957,002, filed Oct. 23, 1997, entitled Thread Switch Controlin a Multithreaded Processor System.

Ser. No. 08/956,875, filed Oct. 23, 1997 entitled An Apparatus andMethod to Guarantee Forward Progress in a Multithreaded Processor nowissued U.S. Pat. No. 6,105,051.

Ser. No. 08/956,577, filed Oct. 23, 1997, entitled Method and ApparatusTo Force a Thread Switch in a Multithreaded Processor now issued U.S.Pat. No. 6,076,157.

Ser. No. 08/773,572, filed Dec. 27, 1996, entitled Background Completionof Instruction and Associated Fetch Request in a Multithread Processornow issued U.S. Pat. No. 6,088,788.

FIELD OF THE INVENTION

The present invention relates generally to digital data processing, andmore particularly to support within a processing unit for logicallypartitioning of a digital computer system.

BACKGROUND OF THE INVENTION

A modern computer system typically comprises a central processing unit(CPU) and supporting hardware necessary to store, retrieve and transferinformation, such as communications busses and memory. It also includeshardware necessary to communicate with the outside world, such asinput/output controllers or storage controllers, and devices attachedthereto such as keyboards, monitors, tape drives, disk drives,communication lines coupled to a network, etc. The CPU is the heart ofthe system. It executes the instructions which comprise a computerprogram and directs the operation of the other system components.

From the standpoint of the computer's hardware, most systems operate infundamentally the same manner. Processors are capable of performing alimited set of very simple operations, such as arithmetic, logicalcomparisons, and movement of data from one location to another. But eachoperation is performed very quickly. Programs which direct a computer toperform massive numbers of these simple operations give the illusionthat the computer is doing something sophisticated. What is perceived bythe user as a new or improved capability of a computer system is madepossible by performing essentially the same set of very simpleoperations, but doing it much faster. Therefore continuing improvementsto computer systems require that these systems be made ever faster.

The overall speed of a computer system (also called the “throughput”)may be crudely measured as the number of operations performed per unitof time. Conceptually, the simplest of all possible improvements tosystem speed is to increase the clock speeds of the various components,and particularly the clock speed of the processor. E.g., if everythingruns twice as fast but otherwise works in exactly the same manner, thesystem will perform a given task in half the time. Early computerprocessors, which were constructed from many discrete components, weresusceptible to significant speed improvements by shrinking componentsize, reducing component number, and eventually, packaging the entireprocessor as an integrated circuit on a single chip. The reduced sizemade it possible to increase the clock speed of the processor, andaccordingly increase system speed.

Despite the enormous improvement in speed obtained from integratedcircuitry, the demand for ever faster computer systems has continued.Hardware designers have been able to obtain still further improvementsin speed by greater integration (i.e., increasing the number of circuitspacked onto a single chip), by further reducing the size of thecircuits, and by various other techniques. However, designers can seethat physical size reductions can not continue indefinitely, and thereare limits to their ability to continue to increase clock speeds ofprocessors. Attention has therefore been directed to other approachesfor further improvements in overall speed of the computer system.

Without changing the clock speed, it is possible to improve systemthroughput by using multiple processors. The modest cost of individualprocessors packaged on integrated circuit chips has made this practical.While there are certainly potential benefits to using multipleprocessors, numerous additional architectural issues are introduced. Inparticular, multiple processors typically share the same main memory(although each processor may have it own cache). It is necessary todevise mechanisms that avoid memory access conflicts. For example, iftwo processors have the capability to concurrently read and update thesame data, there must be mechanisms to assure that each processor hasauthority to access the data, and that the resulting data is notgibberish. Without delving into further architectural complications ofmultiple processor systems, it can still be observed that there are manyreasons to improve the speed of the individual CPU, whether or not asystem uses multiple CPUs or a single CPU. If the CPU clock speed isgiven, it is possible to further increase the speed of the individualCPU, i.e., the number of operations executed per second, by increasingthe average number of operations executed per clock cycle.

In order to boost CPU speed, it is common in high performance processordesigns to employ instruction pipelining, as well as one or more levelsof cache memory. Pipeline instruction execution allows subsequentinstructions to begin execution before previously issued instructionshave finished. Cache memories store frequently used and other datanearer the processor and allow instruction execution to continue, inmost cases, without waiting the full access time of a main memory.

Pipelines will stall under certain circumstances. An instruction that isdependent upon the results of a previously dispatched instruction thathas not yet completed may cause the pipeline to stall. For instance,instructions dependent on a load/store instruction in which thenecessary data is not in the cache, i.e., a cache miss, cannot beexecuted until the data becomes available in the cache. Maintaining therequisite data in the cache necessary for continued execution and tosustain a high hit ratio, i.e., the number of requests for data comparedto the number of times the data was readily available in the cache, isnot trivial especially for computations involving large data structures.A cache miss can cause the pipelines to stall for several cycles, andthe total amount of memory latency will be severe if the data is notavailable most of the time. Although memory devices used for main memoryare becoming faster, the speed gap between such memory chips andhigh-end processors is becoming increasingly larger. Accordingly, asignificant amount of execution time in current high-end processordesigns is spent waiting for resolution of cache misses.

It can be seen that the reduction of time the processor spends waitingfor some event, such as refilling a pipeline or retrieving data frommemory, will increase the average number of operations per clock cycle.One architectural innovation directed to this problem is called“multithreading”. This technique involves breaking the workload intomultiple independently executable sequences of instructions, calledthreads. At any instant in time, the CPU maintains the state of multiplethreads. As a result, it is relatively simple and fast to switchthreads.

The term “multithreading” as defined in the computer architecturecommunity is not the same as the software use of the term which meansone task subdivided into multiple related threads. In the architecturedefinition, the threads may be independent. Therefore “hardwaremultithreading” is often used to distinguish the two uses of the term.As used herein, “multithreading” will refer to hardware multithreading.

There are two basic forms of multithreading. In the more traditionalform, sometimes called “fine-grained multithreading”, the processorexecutes N threads concurrently by interleaving execution on acycle-by-cycle basis. This creates a gap between the execution of eachinstruction within a single thread, which removes the need for theprocessor to wait for certain short term latency events, such asre-filling an instruction pipeline. In the second form ofmultithreading, sometimes called “coarse-grained multithreading”,multiple instructions in a single thread are sequentially executed untilthe processor encounters some longer term latency event, such as a cachemiss.

Typically, multithreading involves replicating the processor registersfor each thread in order to maintain the state of multiple threads. Forinstance, for a processor implementing the architecture sold under thetrade name PowerPC™ to perform multithreading, the processor mustmaintain N states to run N threads. Accordingly, the following arereplicated N times: general purpose registers, floating point registers,condition registers, floating point status and control register, countregister, link register, exception register, save/restore registers, andspecial purpose registers. Additionally, the special buffers, such as asegment lookaside buffer, can be replicated or each entry can be taggedwith the thread number and, if not, must be flushed on every threadswitch. Also, some branch prediction mechanisms, e.g., the correlationregister and the return stack, should also be replicated. However,larger hardware structures such as caches and execution units aretypically not replicated.

In a computer system using multiple CPUs (symmetrical multi-processors,or SMPs), each processor supporting concurrent execution of multiplethreads, the enforcement of memory access rules is a complex task. Inmany systems, each user program is granted a discrete portion of addressspace, to avoid conflicts with other programs and prevent unauthorizedaccesses. However, something must allocate addresses in the first place,and perform other necessary policing functions. Therefore, specialsupervisor programs exist which necessarily have access to the entireaddress space. It is assumed that these supervisor programs contain“trusted” code, which will not disrupt the operation of the system. Inthe case of a multiprocessor system, it is possible that multiplesupervisor programs will be running on multiple SMPs, each havingextraordinary capability to access data addresses in memory. While thisdoes not necessarily mean that data will be corrupted or compromised,avoidance of potential problems adds another layer of complexity to thesupervisor code. This additional complexity can adversely affect systemperformance. To the extent hardware within each SMP can assist softwaresupervisors, performance can be improved.

In a large multiprocessor system, it may be desirable to partition thesystem into one or more smaller logical SMPs, an approach known aslogical partitioning. In addition, once a system is partitioned it maybe desirable to dynamically re-partition the system based on changingrequirements. It is possible to do this using only software. Theadditional complexity this adds to the software can adversely affectsystem performance. Logical partitioning of a system would be moreeffective if hardware support were provided to assist the software.Hardware support may be useful to help software isolate one logicalpartition from another. Said differently, hardware support may be usedto prevent work being performed in one logical partition from corruptingwork being performed in another. Hardware support would also be usefulfor dynamically re-partitioning the system in an efficient manner. Thishardware support may be used to enforce the partitioning of systemresources such as processors, real memory, internal registers, etc.

SUMMARY OF THE INVENTION

It is therefore an object of the present invention to provide animproved processor apparatus.

Another object of this invention is to provide greater support, and inparticular hardware support, for logical partitioning of a computersystem.

Another object of this invention is to provide an apparatus havinggreater hardware regulation of memory access in a processor.

Another object of this invention is to increase the performance of acomputer system having multiple processors.

Another object of the invention is to improve multithreaded processorhardware control for logical partitioning of a computer system.

A processor provides hardware support for logical partitioning of acomputer system. Logical partitions isolate the real address spaces ofprocesses executing on different processors, specifically, supervisoryprocesses. An ultra-privileged supervisor process, called a hypervisor,regulates the logical partitions.

In the preferred embodiment, the processor contains multiple registersets for supporting the concurrent execution of multiple threads (i.e.,hardware multithreading). Each thread is capable of independently beingin either hypervisor, supervisor or problem (non-privileged) state.

In the preferred embodiment, each processor generates effectiveaddresses from executable code, which are translated to real addressescorresponding to locations in physical main memory. Certain processes,particularly supervisory processes, may optionally run in a special(effective address equals real address) mode. In this mode, realaddresses are constrained within a logical partition by effectivelyconcatenating certain high order bits from a special register (realmemory offset register) with lower order bits of the effective address.For clarity, the effective address in effective=real mode is referred toherein as a base real address, while the resultant address afterpartitioning is referred to as a partitioned real address. Logicalpartitioning of the address space amounts to an enforced constraint oncertain high order address bits, so that within any given partitionthese address bits are the same. Partitioning is thus distinguished fromtypical address translation, wherein a range of effective addresses isarbitrarily correlated a range of real addresses. The hardware whichpartitions a real address is actually a set of OR gates which perform alogical OR of the contents of the real memory offset register with anequal number of high order bits of effective address (base realaddress). By convention, the high order bits of effective address (i.e.,in the base real address) which are used constrain the address to alogical partition should be 0. A separate range check mechanismconcurrently verifies that these high order effective address bits arein fact 0, and generates a real address space check signal if they arenot.

In the preferred embodiment, the range check mechanism includes a 2-bitreal memory limit register, and a set of logic gates. The limit registerspecifies the number of high order effective address (base real address)bits which must be zero (i.e., the size of the logical partition memoryresource). The limit register value generates a mask, which is logicallyANDed with selected bits of the effective address. The resulting bitsare then logically ORed together to generate the real address spacecheck signal. The use of this limit register mechanism supportslogically partitioned memory spaces of different sizes.

In the preferred embodiment, instruction addresses can be pre-fetched inanticipation of execution. In particular, dormant thread instructionsmay be pre-fetched while another thread is processing and executinginstructions. The partitioning mechanism checks and controls instructionpre-fetching independently of the actively running thread.

In the preferred embodiment, special operating system software runningin hypervisor state can dynamically re-allocate resources to logicalpartitions. In particular, it can alter the contents of the real memoryoffset register and the real memory limit register which regulate thegeneration of partitioned real addresses; a logical partition identifierwhich identifies the logical partition to which a processor is assigned;and certain configuration information.

In the preferred embodiment, the processor supports different systemswhich use the hypervisor, supervisor and problem states differently.Thus, one mode of operation supports effective=real addressing mode inany state, but addresses are partitioned and checked as described abovewhen operating in non-hypervisor state. A second mode of operationsupports effective=real addressing mode in only the hypervisor state.

The enforcement of logical partitioning by processor hardware whichintercepts a base real address and converts it to a partitioned realaddress removes the need for low-level operating system software toverify certain address constraints among multiple processors andthreads, reducing the burden on operating system software and improvingsystem performance.

Other objects, features and characteristics of the present invention;methods, operation, and functions of the related elements of thestructure; combination of parts; and the like will become apparent fromthe following detailed description of the preferred embodiments andaccompanying drawings, all of which form a part of this specification,wherein like reference numerals designate corresponding parts in thevarious figures.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a high-level block diagram of the major hardware components ofa computer system having multiple CPUs, according to the preferredembodiment of the invention described herein.

FIG. 2 is a high-level diagram of a central processing unit of acomputer system according to the preferred embodiment.

FIG. 3 illustrates the major components of an L1 instruction cache,according to the preferred embodiment.

FIG. 4 illustrates in greater detail real address partitioning logic, aneffective to real address table and associated control structures forinstruction addresses, according to the preferred embodiment.

FIG. 5 illustrates real address partitioning logic for data addresses,according to the preferred embodiment.

FIG. 6 illustrates the generation of instruction storage interrupts forenforcing logical partitioning, according to the preferred embodiment.

FIG. 7 illustrates at a high level the generation of effective addressesfor instructions, according to the preferred embodiment.

FIG. 8 is a logical illustration of address translation, according tothe preferred embodiment.

FIG. 9 illustrates the operation of certain state and configurationregisters, according to the preferred embodiment.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

The major hardware components of a multiprocessor computer system 100for utilizing the logical partitioning architecture according to thepreferred embodiment of the present invention are shown in FIG. 1. CPUs101A, 101B, 101C and 101D for processing instructions contains separaterespective internal level one instruction caches 106A, 106B, 106C, 106D(L1 I-cache) and level one data caches 107A, 107B, 107C, 107D (L1D-cache). Each L1 I-cache 106A, 106B, 106C, 106D stores instructions forexecution by its CPU 101A, 101B, 101C, 101D. L1 D-cache stores data(other than instructions) to be processed by a CPU. Each CPU 101A, 101B,101C, 110D is coupled to a respective level two cache (L2 cache) 108A,108B, 108C, 108D, which can be used to hold both instructions and data.Memory bus 109 transfers data between L2 caches or CPU on the one handand main memory 102 on the other. CPUs 10A, 101B, 101C, 101D, L2 cache108A, 108B, 108C, 108D and main memory 102 also communicate via businterface 105 with system bus 110. Various I/O processing units (IOPs)111-115 attach to system bus 110 and support communication with avariety of storage and I/O devices, such as direct access storagedevices (DASD), tape drives, workstations, printers, and remotecommunication lines for communicating with remote devices or othercomputer systems. For simplicity, CPU, L1 I-cache, L1 D-cache, and L2cache are herein designated generically by reference numbers 101, 106,107 and 108, respectively. While various buses are shown in FIG. 1, itshould be understood that these are intended to represent variouscommunications paths at a conceptual level, and that the actual physicalconfiguration of buses may vary.

In the preferred embodiment, each CPU is capable of maintaining thestate of two threads, and switches execution between threads on certainlatency events. I.e., CPU executes a single thread (the active thread)until some latency event is encountered which would force the CPU towait, (a form of coarse-grained multithreading). Thread switchingconditions and mechanisms are described in greater detail in commonlyassigned copending U.S. patent application Ser. Nos. 08/958,718,08/958,716, 08/957,002, 08/956,875, 08/956,577, all filed Oct. 23, 1997,and incorporated herein by reference. However, it should be understoodthat the present invention could be practiced with a different number ofthread states in each CPU, and that it would be possible to interleaveexecution of instructions from each thread on a cycle-by-cycle basis(fine-grained multithreading), or to switch threads on some differentbasis.

FIG. 2 is a high level diagram of the major components of CPU 101,showing CPU 101 in greater detail than is depicted in FIG. 1, accordingto the preferred embodiment. In this embodiment, the components shown inFIG. 2 are packaged on a single semiconductor chip. CPU 101 includesinstruction unit portion 201, execution unit portion 211 and 212, andstorage control portion 221. In general, instruction unit 201 obtainsinstructions from L1 I-cache 106, decodes instructions to determineoperations to perform, and resolves branch conditions to control programflow. Execution unit 211 performs arithmetic and logical operations ondata in registers, and loads or stores data. Storage control unit 221accesses data in the L1 data cache or interfaces with memory external tothe CPU where instructions or data must be fetched or stored.

Instruction unit 201 comprises branch unit 202, buffers 203, 204, 205,and decode/dispatch unit 206. Instructions from L1 I-cache 106 areloaded into one of the three buffers from L1 I-Cache instruction bus232. Sequential buffer 203 stores 16 instructions in the currentexecution sequence. Branch buffer 205 stores 8 instructions from abranch destination; these are speculatively loaded into buffer 205before branch evaluation, in the event the branch is taken. Threadswitch buffer 204 stores 8 instructions for the inactive thread; in theevent a thread switch is required from the currently active to theinactive thread, these instructions will be immediately available.Decode/dispatch unit 206 receives the current instruction to be executedfrom one of the buffers, and decodes the instruction to determine theoperation(s) to be performed or branch conditions. Branch unit 202controls the program flow by evaluating branch conditions, and refillsbuffers from L1 I-cache 106 by sending an effective address of a desiredinstruction on L1 I-Cache address bus 231.

Execution unit 211 comprises S-pipe 213, M-pipe 214, R-pipe 215 and abank of general purpose registers 217. Registers 217 are divided intotwo sets, one for each thread. R-pipe is a pipelined arithmetic unit forperforming a subset of integer arithmetic and logic functions for simpleintegers. M-pipe 214 is a pipelined arithmetic unit for performing alarger set of arithmetic and logic functions. S-pipe 213 is a pipelinedunit for performing load and store operations. Floating point unit 212and associated floating point registers 216 are used for certain complexfloating point operations which typically require multiple cycles. Likegeneral purpose registers 217, floating point registers 216 are dividedinto two sets, one for each thread.

Storage control unit 221 comprises memory management unit 222, L2 cachedirectory 223, L2 cache interface 224, L1 data cache 107, and memory businterface 225. L1 D-cache is an on-chip cache used for data (as opposedto instructions). L2 cache directory 223 is a directory of the contentsof L2 cache 108. L2 cache interface 224 handles the transfer of datadirectly to and from L2 cache 108. Memory bus interface 225 handles thetransfer of data across memory bus 109, which may be to main memory 102or to L2 cache units associated with other CPUs. Memory management unit222 is responsible for routing data accesses to the various units. E.g.,when S-pipe 213 processes a load command, requiring data to be loaded toa register, memory management unit may fetch the data from L1 D-cache107, L2 cache 108, or main memory 102. Memory management unit 222determines where to obtain the data. L1 D-cache 107 is directlyaccessible, as is the L2 cache directory 223, enabling unit 222 todetermine whether the data is in either L1 D-cache 107 or L2 cache 108.If the data is in neither on-chip L1 D-cache nor L2 cache 108, it isfetched from memory bus 109 using memory interface 225.

While various CPU components have been described and shown at a highlevel, it should be understood that the CPU of the preferred embodimentcontains many other components not shown, which are not essential to anunderstanding of the present invention. For example, various additionalspecial purpose registers will be required in a typical design, some ofwhich must be replicated for each thread. It should also be understoodthat the number, type and arrangement of components within CPU 101 couldbe varied. For example, the number and configuration of buffers andcaches may vary; the number and function of execution unit pipelines mayvary; registers may be configured in different arrays and sets;dedicated floating point processing hardware may or may not be present;etc.

CPU 101 of the preferred embodiment supports multiple levels of addresstranslation, as logically illustrated in FIG. 8. The three basicaddressing constructs are effective address 801, virtual address 802,and real address 803. An “effective address” refers to the address fromthe point of view of the executable code, i.e., it is an instructionaddress generated by instruction unit 201, or a data address generatedby execution unit 211. An effective address may be produced in any ofvarious ways known in the art, e.g., as a concatenation of somehigh-order address bits in a special-purpose register (which changesinfrequently, e.g., when execution of a new task is initiated) and lowerorder address bits from an instruction; as a computed offset from anaddress in a general purpose register; as an offset from the currentlyexecuting instruction; etc., as illustrated in greater detail in FIG. 7,explained below. In this embodiment, an effective address comprises 64bits, numbered 0 to 63 (0 being the highest order bit). A “virtualaddress” is an operating system construct, used to isolate the addressspaces of different users. I.e., if each user may reference the fullrange of effective addresses, then the effective address spaces ofdifferent users must be mapped into a larger virtual address space toavoid conflicts. The virtual address is not a physical entity in thesense that it is stored in registers; it is a logical construction,resulting from a concatenation of a 52-bit virtual segment ID 814 andthe low-order 28 bits of the effective address, a total of 80 bits. A“real address” refers to a physical location in memory 102 where theinstruction or data is stored. The real address comprises 40 bitsnumbered 24 to 63 (24 being the highest order bit).

As shown in FIG. 8, an effective address 801 comprises 36-bit effectivesegment ID 811, 16-bit page number 812, and 12-bit byte index 813, theeffective segment ID occupying the highest order bit positions. Avirtual address 802 is constructed from an effective address by mappingthe 36-bit effective segment ID 811 to a 52-bit virtual segment ID 814,and concatenating the resultant virtual segment ID 814 with page number812 and byte index 813. A real address 803 is derived from the virtualaddress by mapping the virtual segment ID 814 and page number 812 to a28-bit real page number 815, and concatenating the real page number withbyte index 813. Because a page of main memory contains 4K (i.e., 2¹²)bytes, the byte index 813 (lowest order 12 address bits) specifies anaddress within a page, and is the same whether the address is effective,virtual or real. The higher order bits specify a page, and are thereforesometimes referred to as an “effective page number” or “real pagenumber”, as the case may be.

Computer system 100 contains an address translation mechanism fortranslating effective addresses generated by CPU 101 to real addressesin memory 102. This address translation mechanism includes a segmenttable mechanism 821 for mapping effective segment ID 811 to virtualsegment ID 814, and a page table mechanism 822 for mapping virtualsegment ID 814 and page number 812 to real page number 815. While thesemechanisms are shown in FIG. 8 as single entities for illustrativepurposes, they in fact comprise multiple tables or register at differentlevels. I.e., a complete page table and a complete segment table residein main memory 102, while various smaller cached portions of the data inthese tables is contained in CPU 101 itself or the L2 cache. There areadditional translation mechanisms (not shown) which will in limitedcircumstances translate directly from an effective to a real address.

While CPU 101 supports address translation as illustrated in FIG. 8, italso supports more simple addressing. Specifically, one of the operatingmodes is a “tags active” mode, in which effective addresses are the sameas virtual addresses (i.e., an effective segment ID 811 maps directly tovirtual segment ID 814 without lookup, so that the high-order 16 bits ofvirtual segment ID are always 0). CPU 101 may also operate in aneffective=real addressing mode.

Effective=real mode (E=R) is a special addressing mode, typicallyreserved for certain low level operating system functions which operatemore efficiently if always stored at the same real address locations.These operating system functions may need to access reserved areas ofmemory, and therefore typically execute in a special privileged state(as opposed to most user executable code, which executes in anon-privileged state called a “problem state”). These operating systemfunctions are created and tested by a process assumed to be trusted, inthe sense that the resulting code will not cause unauthorizedinterference with machine processes. When executing in E=R mode andwithout logical partitioning, the lower order 40 bits of effectiveaddress (i.e., EA_(24:63)) generated by instruction unit 201 (in thecase of instructions) or execution unit 211 (in the case of data) is thesame as the real address (RA_(24:63)); the high order effective addressbits are assumed to be 0. When operating in E=R mode, addresses are nottranslated, i.e., the page table mechanism and segment table mechanism,described above, along with any associated caches, are not used. Thishas the effect of mapping all E=R mode processes to the same realmemory, even when executing on different processors. E=R mode addressingis active when either (a) an applicable address translate bit in one ofthe machine state registers is set off, or (b) under certaincircumstances, when the effective address lies within a special reservedrange of addresses. Appropriate hardware logic (not shown) detects theseconditions and generates an E=R control signal for use by addressinglogic.

In the preferred embodiment, computer system 100 can be logicallypartitioned. Logical partitioning means that the system is logicallydivided into multiple subsets called logical partitions, and some of thesystem resources are assigned to particular logical partitions, whileother resources are shared among partitions. In the preferredembodiment, processors and real memory are assigned to logicalpartitions in a partitioned system, while buses, I/O controllers, andI/O devices are shared, it being understood that it would be possible toassign different types and mixtures of devices to partitions. In alogically partitioned system, each processor of the multiprocessorsystem is assigned to a partition, along with a subset of the realmemory address space. With limited exceptions (explained below), tasksexecuting on a processor can only access real memory within thatprocessor's subset of the real memory address space. This has the effectof isolating tasks executing on different processors in differentlogical partitions. From the standpoint of CPU and memory, the logicallypartitioned multiprocessor computer system behaves very much likemultiple separate computer systems. This avoids some of the contentionand other overhead issues associated with prior art multiprocessorsystems. At the same time, the different logical partitions sharehardware resources such as disk storage and I/O, as well as certain lowlevel software resources. Thus, many of the advantages of amultiprocessor system over multiple discrete single processor systemsare maintained. Furthermore, it is possible for multiple processors toshare a single logical partition. For example, a computer systemcontaining 16 processors could be configured in four logical partitions,each containing four processors, and resembling in certaincharacteristics the performance of four 4-way multiprocessor systems asopposed to a single 16-way multiprocessor system.

Since user executable (non-privileged) code is typically translated asdescribed above from an effective address to a real address (with orwithout the intermediate virtual address), this same basic mechanism canbe used to support logical partitioning. The operating system willassign a block of user-accessible address space to a block of realmemory address space lying within the logical partition of the processorexecuting the user code. Subsequent references to an effective addresswithin this block will be translated using the translation mechanisms tothe corresponding block of real memory address space. Thus, userexecutable code will reference something within the logical partition ofthe processor, without affecting memory outside the processor's logicalpartition.

However, the translation mechanism can not enforce logical partitioningof address references in E=R mode. Generally, this is privileged code,created using a trusted process. Even though the code is created using atrusted process, there are performance reasons to isolate such codeexecuting on different processors to different logical partitions. Atthe same time, there is still a need for some operating system functionsto have access to the entire real memory.

To support logical partitioning, two privileged execution states aredefined, in addition to the non-privileged “problem state”. Theprivileged execution states are called “supervisor state” and“hypervisor state”. Most privileged functions execute in the supervisorstate, and are confined to the logical partition of the processor uponwhich they are executing. Supervisor state code may be untranslated, inwhich case the high-order effective address bits are directlymanipulated by hardware to confine address references to the logicalpartition of the executing processor. In this manner, duplicates ofthese functions can concurrently execute on different processors indifferent logical partitions, without concern for the effect on otherlogical partitions. Only a select few functions, such as those whichsupport logical partitioning itself, execute in the ultra-privilegedhypervisor state, and have access to the full real address space ofcomputer system 100. Each executing thread has its own privilege state(either hypervisor, supervisor, or problem), which is independent of theprivilege state associated with any other thread.

Processor state and configuration information is maintained in a set ofspecial-purpose registers. FIG. 9 illustrates some of these registersand associated control structures. The key register is Active-ThreadMachine State Register (MSR) 901, which maintains certain stateinformation for the currently active thread. Dormant-Thread MachineState Register (MSRDorm) 902 maintains the same type of information forthe currently dormant thread. Each register 901, 902 contains thefollowing respective bits, among others:

DR bit, which indicates the corresponding thread's data addresses shouldbe translated;

IR bit, which indicates the corresponding thread's instruction addressesshould be translated;

Pr bit, which indicates whether the corresponding thread is in problemstate;

TA bit, which indicates “tags active” mode;

HV bit, which indicates the corresponding thread is in hypervisor state;

FIG. 9 illustrates respective data relocate (DR) signal lines 921, 931;instruction relocate (IR) signal lines 922, 932; problem state signallines 923, 933; tags active signal lines 924, 934; and hypervisor statesignal lines 925, 935.

A machine state register is not permanently associated with a thread;rather, there is one physical register 901 which always contains theinformation for the active thread, and another which contains thedormant thread's information. For this reason, an Active ThreadIdentifier bit 961 is needed to identify which is the active or dormantthread. ActThreadID bit 961 is kept in a separate special register. Upona thread switch, the contents of registers 901 and 902 are swapped, andActThreadID bit 961 is changed. Swapping register contents simplifiesdownstream control mechanisms, since in most cases only the contents ofthe active thread MSR 901 are relevant.

As shown in FIG. 9, input to each machine state register 901, 902 iscontrolled by a 10 respective multiplexer 903, 904, which receivesinputs from various sources. The inputs to multiplexer 903 illustratethe various ways in which MSR 901 can be altered. Input path 941represents a move to MSR (mtMSR) instruction, i.e., MSR 901 can bealtered by executing a special mtMSR instruction while in a privilegedstate, which causes data to be loaded directly from a general purposeregister into the MSR. Input path 942 represents an interrupt state,i.e., upon occurrence of an interrupt condition, the MSR isautomatically loaded with a predefined state associated with theinterrupt. Input paths 943 and 944 represent a System Call and a SystemCall Vectored, respectively. These are special processor instructions,typically made while in the problem state in order to invoke aprivileged state. Both cause a predefined state to be loaded into MSRand a jump to a predefined location. System Call Vectored does notaffect as many bits in the MSR as does System Call, i.e., System CallVectored causes only a few bits to change, most of the bits being simplycopied from their current state. Return from System Call Vectored(rfscv) path 945 represents reloading the MSR with its previous stateupon return from a System Call Vectored; these values are stored in aspecial register (not shown). Return from interrupt/system call path 946is conceptually similar to rfscv 945, and represents reloading the MSRwith its previous state upon return from an interrupt or a System Call.The previous state of the MSR is saved in SRR1 registers 905, 906, whichare special purpose registers for holding a saved state. One SRR1register is associated with each thread, and the state of MSR 901 issaved to the register associated with the currently active thread asidentified by ActThreadID 961. Upon return from an interrupt or SystemCall, multiplexer 907 selects the appropriate register 905 or 906 forrestoring the previous MSR state. Input path 947 represents the contentsof MSRDorm 902, which is loaded into MSR 901 upon a thread switch. Inputpath 948 represents the current contents of MSR 901; because some of theevents which cause changes to MSR 901 do not affect all bits, this pathrepresents a copying of non-affected bits back into MSR 901.

MSRDorm 902 is altered in similar fashion, although fewer paths areshown in FIG. 9 because an interrupt, System Call, or System CallVectored can apply only to the currently active thread. Like MSR 901,MSRDorm902 can be altered by a special move to MSRDorm instruction, asrepresented by path 951. MSRDorm will receive the contents of MSR 901upon a thread switch, as represented by path 952. Finally, path 953represents copying bits not affected by a change back into MSRDorm 902.

Also shown in FIG. 9 is a set of configuration registers 910. Unlike MSR901 and MSRDorm 902, these registers contain configuration informationwhich is intended to change rarely, if at all. I.e., information inconfiguration registers 910 might be set upon initial installation of asystem and might be altered upon major reconfiguration, such as theaddition of processors to the system, or the system beingre-partitioned. These registers can be altered only in hypervisor mode,i.e., are not intended to be written to from user executable code.Typically, information is loaded into configuration registers by aspecial-purpose service processor during system initialization. Amongthe information held in configuration registers 910 is a LogicalPartitioning Environment Selector (LPES) bit 911. This bit is used tospecify one of two operating system environments, designated “RS” and“AS”. In the “RS” environment, non-hypervisor address references in E=Rmode must be forced into the real memory subset of the processor'slogical partition; in the “AS” environment, non-hypervisor addressreferences in E=R mode are not allowed. Configuration registers 910 alsocontain a 12-bit real memory offset field 912, also referred to as areal memory offset register (RMOR), although it is physically part ofthe larger configuration register set 910. Configuration registers 910also contain a 2-bit real memory limit field 913, also referred to as areal memory limit register (RMLR). Configuration registers 910 furthercontain a Logical Partition ID (LPID) field 914, which is an identifierassigned to the logical partition to which the processor belongs.

The Pr bits 923, 933 and HV bits 925, 935 define the privilege state. Ifthe HV bit is set, the corresponding thread is in the hypervisor state.If the HV bit is not set and the Pr bit is set, the corresponding threadis in the problem state. If nether bit is set, the corresponding threadis in the supervisor state. The HV bit can not be altered by a mtMSRinstruction, for this would allow a thread in supervisor state to placeitself in hypervisor state. The HV bit can only be set automatically bythe hardware under certain predefined conditions, specifically certaininterrupts (depending on the setting of LPES bit 911) or certain SystemCalls, any of which cause instructions to branch to one of a set ofpredefined locations. Naturally, these predefined locations must containtrusted code suitable for execution in hypervisor state. All predefinedlocations associated with Hypervisor state are contained within a singlereal address subset at the low address range. This subset is reservedand can not be assigned to any processor of multiprocessor system 100.The conditions for setting the HV bit can be summarized as follows:

MSR(HV)<==(LPES AND (Any_Interrupt OR System_Call₂₆)) OR (LPES AND(Machine_Check_Interrupt OR System_Reset_Interrupt OR System_Call₂₆))

Where System_Call₂₆ indicates a System Call (not including a System CallVectored) in which bit 26 is set. Upon return from the interrupt orsystem call, the previous thread state is reloaded in the MSR registerfrom one of SRR1 registers 905 or 906. This previous state includes theprevious value of HV bit 925, and the HV bit is thus reset to itsprevious value

In a logically partitioned multiprocessor system, all address referencesin either problem or supervisor state should be confined to the logicalpartition associated with the processor which generated the address.Only in the hypervisor state should it be possible to reference anaddress outside this range.

FIG. 7 illustrates at a conceptual level the generation of effectiveaddresses of instructions in instruction unit 201. Instruction unit 201is capable of generating an address in any of a variety of ways. I0Instruction Address Register 701 represents generation from an addressin the instruction address register, i.e., an immediate address in thecurrent thread. The most common way to generate an address is byincrementing this address, represented as path 711. In some cases, theaddress in I0IAR 701 is used directly (e.g., when it was loaded intoI0IAR 701), represented as path 710. Branch Address (relative) block 702represents a relative branching instruction, in which an offset may becontained in the instruction or in a register. Because this is a branchrelative instruction, the offset is added to low order address bits fromI0IAR, and the high order bits from I0IAR may be incremented,decremented, or passed through unchanged. These bits are then combined,represented as path 712. Bpipe-Base block 703 represents generation ofan absolute branch through various means, usually using a hardwarebranch pipeline, such as branching to a value from a general purpose ora special register, a value derived as a combination of bits in theinstruction and register bits, indirect addressing, etc. SCV block 704represents an address resulting from a system call or interruptcondition, which branch to predefined locations. Fetch InstructionAddress Register block 705 represents address generation for speculativeconditions. As shown, this might involve generation of the nextinstruction address for a dormant thread (block 706) or SRR0 registerswhich bold return from interrupted addresses for the current thread(block 707) and dormant thread (block 708), these values being swappedon a thread switch.

Ideally, instruction unit 201 provides a constant stream of instructionsfor decoding in decoder 206, and execution by execution unit 211. L1I-cache 106 must respond to an access request with minimal delay. Wherea requested instruction is actually in L1 I-cache, it must be possibleto respond and fill the appropriate buffer without requiringdecoder/dispatcher 206 to wait. Where L1 1-cache can not respond (i.e.,the requested instruction is not in L1 I-cache), a longer path via cachefill bus 233 through memory management unit 222 must be taken. In thiscase, the instruction may be obtained from L2 cache 108, from mainmemory 102, or potentially from disk or other storage. It is alsopossible that the instruction will be obtained from L2 cache of anotherprocessor. In all of these cases, the delay required to fetch theinstruction from a remote location may cause instruction unit 201 toswitch threads. I.e., the active thread becomes inactive, the previouslyinactive thread becomes active, and the instruction unit 201 beginsprocessing instructions of the previously inactive thread held in threadswitch buffer 204.

FIG. 3 illustrates the major components of L1 1-cache 106 in greaterdetail than shown in FIGS. 1 or 2, according to the preferredembodiment. L1 I-cache 106 includes effective-to-real address table(ERAT) 301, I-cache directory array 302, and I-cache instruction array303. I-cache instruction array 303 stores the actual instructions whichare supplied to instruction unit 201 for execution. I-cache directoryarray 302 contains a collection of real page numbers, validity bits, andother information, used to manage instruction array 303, and inparticular to determine whether a desired instruction is in fact in theinstruction array 303. ERAT 301 contains pairs of effective page numbersand real page numbers, and is used for associating effective with realaddresses.

When instruction unit 201 requests an instruction from I-cache 106,providing an effective address of the requested instruction, I-cachemust rapidly determine whether the requested instruction is in fact inthe cache, return the instruction if it is, and initiate action toobtain the instruction from elsewhere (e.g., L2 cache, main memory) ifit is not. In the normal case where the instruction is in fact in L1I-cache 106, the following actions occur concurrently within theI-cache, as illustrated in FIG. 3:

(a) The effective address from instruction unit 201 is used to access anentry in ERAT 301 to derive an effective page number and associated realpage number.

(b) The effective address from instruction unit 201 is used to access anentry in directory array 302 to derive a pair of real page numbers.

(c) The effective address from instruction unit 201 is used to access anentry in instruction array 303 to derive a pair of cache linescontaining instructions.

In each case above, the input to any one of ERAT 301, directory array302, or instruction array 303, is not dependent on the output of anyother one of these components, so that none of the above actions needawait completion of any other before beginning. The output of the ERAT301, directory array 302, and instruction array 303 are then processedas follows:

(a) The effective page number from ERAT 301 is compared with the sameaddress bits of the effective address from instruction unit 201 incomparator 304; if they match, there has been an ERAT “hit”. (But whereaddressing in E=R mode, the ERAT is always deemed “hit” regardless ofthe comparison, as explained below.)

(b) The real page number from ERAT 301 is compared with each of the realpage numbers from directory array 302 in comparators 305 and 306; ifeither of these match, and if there has been an ERAT hit, then there isan I-cache “hit”, i.e., the requested instruction is in fact in I-cache106, and specifically, in instruction array 303.

(c) The output of the comparison of real page numbers from ERAT 301 anddirectory array 302 is used to select (using selection multiplexer 307)which of the pair of cache lines from instruction array 303 contains thedesired instruction.

Performing these actions concurrently minimizes delay where the desiredinstruction is actually in the I-cache. Whether or not the desiredinstruction is in the I-cache, some data will be presented on theI-cache output to instruction unit 201. A separate I-cache hit signalwill indicate to instruction unit 201 that the output data is in factthe desired instruction; where the I-cache hit signal absent,instruction unit 201 will ignore the output data. The actions taken byI-cache 106 in the event of a cache miss are discussed later herein.

FIG. 4 shows in greater detail ERAT 301, and associated controlstructures. ERAT 301 is an 82-bit×128 array (i.e, contains 128 entries,each having 82 bits). Each ERAT entry contains a portion (bits 0-46) ofan effective address, a portion (bits 24-51) of a real address, andseveral additional bits described below. ERAT 301 may be thought of as asmall cache directly mapping a subset of effective addresses to theirrespective real addresses, thus avoiding the delays inherent in theaddress translation mechanism depicted in FIG. 8, described above.Because ERAT 301 is a cache of the larger mapping structures, mapped-toreal addresses within the ERAT are confined to the logical partition ofthe processor which generated the effective address if partitionintegrity is maintained within the larger mapping structures, which isthe responsibility of the operating system.

ERAT 301 is accessed by constructing a hash function of bits 45-51 ofthe effective address (EA), along with two control lines: multi-threadcontrol line (MT), which indicates whether multithreading is active (inthe CPU design of the preferred embodiment, it is possible to turnmultithreading off); and ActThreadID line 961. The hash function (HASH)is as follows:

HASH_(0:6)=(EA₄₅ANDMT) OR (ActThreadID AND MT) ∥EA₄₆∥EA₃₈XOREA₄₇∥EA₃₉XOR EA₄₈∥EA_(49:51)

As can be seen, this is a 7-bit function, which is sufficient in theERAT. Select logic 401 selects the appropriate ERAT entry in accordancewith the above hash function.

Comparator 304 compares bits 0-46 of the effective address generated byinstruction unit 201 with the effective address portion of the selectedERAT entry. Because bits 47-51 of the effective address from instructionunit 201 were used to construct the hash function, it can be shown thata match of bits 0-46 is sufficient to guarantee a match of the fulleffective page number portion of the address, i.e. bits 0-51. A match ofthese two address portions means that the real page number (RA_(24:51))in the ERAT entry is in fact the real page number corresponding to theeffective address page number (EA_(0:51)) specified by instruction unit201. For this reason, the effective address portion stored in an ERATentry is sometimes loosely referred to as an effective page number,although in the preferred embodiment it contains only bits 0-46 of theeffective page number.

Because the ERAT effectively by-passes the address translationmechanisms described above and depicted in FIG. 8, the ERAT duplicatessome of the access control information contained in the normal addresstranslation mechanism. I.e., a translation of effective address to realaddress will normally verify access rights through additionalinformation contained in segment table 821, page table 822, orelsewhere. ERAT 301 caches a subset of this information to avoid theneed to refer to these address translation mechanisms. Furtherinformation about the operation of the ERAT can be found in U.S. patentapplication Ser. No. 08/966,706, filed Nov. 10, 1997, entitledEffective-To-Real Address Cache Managing Apparatus and Method, hereinincorporated by reference.

Each ERAT entry contains several parity, protection, and access controlbits. In particular, each ERAT entry includes a cache inhibit bit, aproblem state bit, and an access control bit. Additionally, separatearray 403 (1 bit×128) contains a single valid bit associated with eachrespective ERAT entry. Finally, a pair of tag mode bits is stored inseparate register 404. The valid bit from array 403 records whether thecorresponding ERAT entry is valid; a variety of conditions might causeprocessor logic (not shown) to reset the valid bit, causing a subsequentaccess to the corresponding ERAT entry to reload the entry. The cacheinhibit bit is used to inhibit writing the requested instruction toI-cache instruction array 303. I.e., although a range of addresses maycontain an entry in ERAT, it may be desirable to avoid cachinginstructions in this address range in the I-cache. In this case, everyrequest for an instruction in this address range will cause the linefill sequence logic (described below) to obtain the requestedinstruction, but the instruction will not be written to array 303 (norwill directory array 302 be updated). The problem state bit records the“problem state” of the active thread (from MSR(Pr) bit 923) at the timethe ERAT entry is loaded. A thread executing in privileged stategenerally has greater access rights than one in problem state. If anERAT entry were loaded during one state, and the problem statesubsequently changed, there is a risk that the currently executingthread should not have access to addresses in the range of the ERATentry, and this information must accordingly be verified when the ERATis accessed. The access control bit also records access information atthe time the ERAT entry was loaded, and is checked at the time ofaccess. Tag mode bits 404 record the tag mode of the processor (tagsactive or tags inactive) when the ERAT was loaded; there is one tag modebit associated with each half (64 entries) of the ERAT, which isselected using the 0 bit of the ERAT HASH function. Since tag modeaffects how effective addresses are interpreted, a change to tag modemeans that the real page numbers in the ERAT entry can not be consideredreliable. It is expected that the tag mode will change infrequently, ifever. Therefore, if a change is detected, all entries in thecorresponding half of the ERAT are marked invalid, and are eventuallyreloaded.

When CPU 101 is executing in effective=real mode, the ERAT iseffectively bypassed. In a non-logically partitioned system, E=R wouldimply that the lower order 40 bits of effective address (i.e.,EA_(24:63)) generated by instruction unit 201 are the same as the realaddress (RA_(24:63)), and hence any real address is potentiallyaccessible. Logical partitioning requires that the effective addresses(base real address) be converted to a partitioned real address, i.e. onethat is confined to some subset of the real address space. Bitwise ORlogic 422 performs a logical OR of each bit in real memory offsetregister (RMOR) from configuration register set 910, with acorresponding bit of effective address in the range of bits 24 to 35,i.e., 12 bits in all are ORed. The bits in the RMOR correspond to thereal address space of a logical partition. When using E=R mode and notin hypervisor state, the high order effective address bits in the rangeof those which enforce logical partitioning should all be zeroes. ORlogic 422 is used instead of simple concatenation in order to supportlogically partitioned real address space subsets of different sizes. Inthe preferred embodiment, real address space subset sizes of 64 GB (2³⁶bytes), 4 GB (2³² bytes) and 256 MB (2²⁸ bytes) are supported. Forexample, when a partition size of 64 GB is being used, the 4 high orderbits in RMOR will identify a real address space subset allocated to alogical partition, the 8 low order bits of RMOR must be set to 0,EA_(24:27) must be 0, and EA_(28:63) will specify a real address withinthe subset of the logical partition. Similarly, where a real addressspace subset size of 256 MB is being used, all 12 bits of the RMOR willidentify a real address space subset, EA_(24:35) must be 0, andEA_(36:63) will specify a real address within the logical partition. Inhypervisor state, a processor has access to the entire real memoryaddress space and system resources, and the RMOR is therefore by-passed.Additionally, the RMOR is by-passed when LPES bit 911 is 0, indicatingthat computer system 100 is configured in “AS” environment. As shown inFIG. 4, HV bit 620 and LPES bit 911 control multiplexer 421, whichselects effective address bits 24-35 (EA_(24:35)) if either of theseconditions is present, and otherwise selects the output of OR logic 422.

As shown in FIG. 4, when control line E=R is active, selectionmultiplexer 402 selects RA_(24:51) from the selected ERAT entry as thereal page number (RPN) output when E=R is false, and multiplexer 402selects the output of multiplexer 421, concatenated with EA_(36:51) whenE=R is true. Additionally, where E=R is true, the ERAT is deemed to behit regardless of the comparison result in comparator 304.

ERAT logic 405 generates several control signals which control the useof the RPN output of selection multiplexer 402 and ERAT maintenance,based on the output of selector 304, the effective=real mode, thevarious bits described above, and certain bits in the CPU's MachineState Register (or MSRDorm, as the case may be). In particular, logic405 generates ERAT Hit signal 410, Protection Exception signal 411, ERATMiss signal 412, and Cache Inhibit signal 413.

ERAT Hit signal 410 signifies that the RPN output of selectionmultiplexer 402 may be used as the true real page number correspondingto the requested effective address. This signal is active whenefective=real (by-passing the ERAT); or when comparator 304 detects amatch and there is no protection exception and certain conditions whichforce an ERAT miss are not present. This can be expressed logically asfollows:

ERAT_Hit=(E=R) OR (Match_304 ANDProtection_Exc ANDForce_Miss)

Where Match_304 is the signal from comparator 304 indicating thatEA_(0:46) from instruction unit 201 matches EA_(0:46) in the ERAT entry.

Protection Exception signal 411 signifies that, while the ERAT entrycontains valid data, the currently executing process is not allowed toaccess it. ERAT Miss signal 412 indicates that the requested ERAT entrydoes not contain the desired real page number, or that the entry can notbe considered reliable; in either case, the ERAT entry must be reloaded.Cache inhibit signal 413 prevents the requested instruction from beingcached in instruction array 303. These signals are logically derived asfollows:

Force_Miss=Valid OR (MSR(Pr)≠ERAT(Pr)) OR (MSR(TA)≠Tag_404)

Protection_Exc=(E=R) ANDForce_Miss AND Match_304 AND ERAT(AC) AND(MSR(Us) ORMSR(TA))

ERAT_Miss=(E=R) AND (Match_304 OR Force_Miss)

Cache_Inhibit=(E=R) AND ERAT(CI)

Where:

Valid is the value of valid bit from array 403;

ERAT(Pr) is the problem state bit from the ERAT entry;

ERAT(AC) is the access control bit from the ERAT entry;

ERAT(CI) is the cache inhibit bit from the ERAT entry;

MSR(TA) is the tags active bit from the Machine State Register;

MSR(Us) is the User state bit from the Machine State Register; and

Tag_404 is the selected tag bit from register 404.

I-cache directory array 302 and contains 512 entries, each having a pairof real page numbers, validity bits, parity bits, and amost-recently-used bit. An entry in array 302 is selected usingeffective address bits 48-56 (EA_(48:56)), which are used as a sparsehash function. Because there is no guarantee that either of the realpage numbers contained in an entry in array 302 correspond to the fulleffective address page number of the desired instruction, both selectedreal page numbers are simultaneously compared with the real page numberoutput 411 of ERAT 301, using comparators 305 and 306. The output ofthese and certain other logic determines which real page number, if anycan be used. EA_(48:58) simultaneously selects an entry from instructionarray 303, and the results of comparators 305, 306 are used to selectwhich set (i.e., which half of the entry) contains the associatedinstruction.

The above text describes the situation where the instruction sought isactually in the I-cache. Where there has been an I-cache miss, there aretwo possibilities: (a) there has been an ERAT hit, but the instructionis not in the instruction array; or (b) there has been an ERAT miss. Inthe case where there has been an ERAT hit, it is possible to fill thedesired cache line significantly faster. Because the real page number isin the ERAT, the desired data is known to be in main memory (andpossibly in an L2 cache). It is possible for logic in L1 I-cache 106 toconstruct the full real address of the desired instruction from ERATdata, without accessing external address translation mechanisms, and tofetch this data directly from L2 cache or memory. In the case wherethere has been an ERAT miss, an external address translation mechanismmust be accessed in order to construct the real address of the desiredinstruction, and to update the ERAT as necessary with the new real pagenumber. It is possible that in this case, the desired data will notexist in main memory at all, and will have to be read in from secondarystorage such as a disk drive.

Further information concerning the operation of L-1 I-cache 106 iscontained in U.S. patent application Ser. No. 09/266,133, filed Mar. 10,1999, entitled Instruction Cache for Multithreaded Processor, hereinincorporated by reference.

As described above, OR logic 422 performs a logical OR of address bitsfrom the RMOR and the effective address to create an logicallypartitioned effective address which is offset from the effective addressgenerated by instruction unit 201. The use of OR logic presumes thatcertain high order bits of the effective address are zeroes, otherwisethe bits identifying the logical partition can be corrupted. Theseconditions and others are verified by address protection logic shown inFIG. 6.

As shown in FIG. 6, the 2-bit real memory limit register (RMLR) 913 andeffective address bits 24-35 (EA_(24:35)) are input to partition sizedecode logic 601. The RMLR designates the size of the logicalpartitions, as follows:

RMLR value: 0 0 Partition size: 64 GB 1 0 4 GB 1 1 256 MB

Decode logic 601 outputs an address-out-of-range signal 604, a singlebit value which is a logic ‘1’ if the effective address runs outside theestablished partition size as specified in the RMLR. The logic functionperformed by decode logic 601 can be expressed as:

AOR=EA₂₄ OR EA₂₅ OR EA₂₆ OR EA₂₇ OR (RMLR₀ AND EA₂₈) OR (RMLR₀ AND EA₂₉)OR (RMLR₀ AND EA₃₀) OR (RMLR₀ AND EA₃₁) OR (RMLR₁ AND EA₃₂) OR (RMLR₁AND EA₃₃) OR (RMLR₁ AND EA₃₄) OR (RMLR₁ AND EA₃₅)

Decode logic 601 generates an AOR signal as described above for alleffective addresses generated by instruction unit 201. However, thesignal is significant only if certain conditions are met. Specifically,if the effective address is translated through the address translationmechanism shown in FIG. 8, then the AOR signal is ignored because thereis no correspondence of high order effective address bits and realaddress bits, and logical partitioning code under the control of theoperating system assures that values in the translation tables enforcelogical partitioning. The AOR signal is also ignored if the thread forwhich the address is generated is in hypervisor state, since such athread is authorized to access all logical partitions. Finally, the AORsignal is ignored if the LPES bit is 0 (indicating an“AS” systemenvironment).

The logic which performs these functions is shown in FIG. 6 as selectors610, 611, and RS real address space check logic 602. Selector 610selects either MSR(IR) signal 922 or MSRDorm(IR) signal 932, dependingon incoming signal from DTA (Dormant Thread Address access select) line612. DTA line 612 is active when the effective address is generated onbehalf of the dormant thread, i.e., in the case of a background fetch ofthe dormant thread's instructions. In all other cases, the DTA line islow, indicating that the address is generated on behalf of the activethread. Selector 610 outputs on IR line 621 the MSRDorm(IR) signal ifDTA line 612 is active, otherwise outputs the MSR(IR) signal. Selector611 similarly selects either MSR(HV) signal 925 or MSRDorm(HV) signal935, depending on DTA input 612. The output of selector 611, designatedHV 620, is also used as input to multiplexer 421. The outputs ofselectors 610 and 611 can be logically expressed as follows:

IR=(DTA AND MSR(IR)) OR (DTA AND MSRDorm(IR))

HV=(DTA AND MSR(HV)) OR (DTA AND MSRDorm(HV))

The output of RS real address space check logic 602 can be expressed asfollows:

RS_check=LPES AND AOR ANDHV ANDIR

Where an“AS” mode operating system is used, AS real address space checklogic 603 will generate an AS check signal if there is an attempt togenerate an address in E=R mode, while not in hypervisor state. In otherwords, when in“AS” mode, E=R addressing can only be used in hypervisorstate. The output of AS real address space check logic 603 can beexpressed as follows:

AS_check=LPES ANDHV ANDIR

As shown in FIG. 6, an instruction storage interrupt is generated ifthere is an AS check or if there is and RS check, i.e.

LPAR ISI=AS_check OR RS_check

This is simply one set of possible conditions which may cause aninterrupt. A protection exception signal 411 (explained above) alsocauses an instruction storage interrupt, as do various other conditions.The effect of the instruction storage interrupt is that the generatedaddress is not accessed by the processor, and appropriate interruptroutines are called.

The above text and accompanying figures explain how addresses ofinstructions are verified and mapped to an address range correspondingto the logical partition of the processor which generated the address.Addresses of data are processed in a similar, although simplified,manner. Data addresses are processed using the logic depicted in FIGS. 5and 6. Much of the logic which processes data addresses is physicallyseparate from the logic which processes instruction addresses, althoughthe two operate in a similar manner.

Unlike instructions (which may be pre-fetched for either the active ordormant thread), only the active thread generates data addresses.Therefore some of the logic shown in FIG. 6, which is required toprocess pre-fetched instruction addresses for a dormant thread, is notneeded in the case of data addresses. Additionally, the L1 data cachedoes not use an ERAT.

FIG. 5 depicts the real address partitioning mechanism for dataaddresses, analogous to the partitioning mechanism for instructionaddresses shown in FIG. 4. Execution unit 211 generates a data addressby any of various conventional means known in the art, e.g., as a valuetaken from a register, as a field of an instruction concatenated oroffset from a register value, as a computed value from multipleregisters, etc. The effective address may or may not requiretranslation. Where translation is indicated (E=R is false), address bits0-51 are input to the translation mechanism (depicted at a high level inFIG. 8), which produces a translated 28-bit real page number. Wheretranslation is not indicated (E=R is true), a partitioned real addressis produced from the effective address in a manner similar to thatexplained above for instruction addresses. I.e., EA_(24:35) is bitwiseORed with the contents of real memory offset register 912 by OR logic522. Multiplexer 521 selects EA_(24:35) if either HV 620 or LPES 911 istrue, otherwise selects the output of logic 522. The output ofmultiplexer 521 is concatenated with EA_(36:51) for input to multiplexer502. Multiplexer 502 chooses either translated 28-bit real page numberfrom the translation mechanism, or the output of multiplexer 521, as the28-bit real page number, i.e., real address bits 24 to 51. The 12-bitbyte index within the real page is taken directly from EA_(52:63).

As in the case of instruction addresses, separate logic circuitry fordata addresses produces an error signal. This logic is similar to thatshown in FIG. 6, but simplified. In particular, because data addressesare only generated on behalf of the currently active thread, selectors610 and 611 are not used in the logic which checks for LPAR addresserrors in data addresses. I.e., in the case of data addresses,HV=MSR(HV) and DR=MSR(DR). AS Real Address Space Check logic 603 issimilarly simplified because only MSR(TA) and MSR(Pr) (and notMSRDorm(TA) and MSRDorm(Pr)) are used as input.

LPID 914 is used as a tag in certain bus operations to identify therelevant logical partition, thus limiting the effect of the busoperation and improving efficiency. A processor receiving data in suchan operation from a bus to which it is attached will compare the tagreceived on the bus (the logical partition ID to which the operationpertains) with its own logical partition ID stored in its configurationregister 910. If the two are not identical, the operation is ignored bythe processor.

A simple example will demonstrate the potential performance improvementof this arrangement. ERAT 301 is essentially a cache of some of theinformation contained in segment table 821 and page table 822, thesegment and page tables being external to the processor. Each logicalpartition has its own segment and page tables, which are maintainedindependently of those in other logical partitions. Since a logicalpartition may contain multiple processors, activity in another processormay cause a page fault or other condition which alters the contents ofone or the other of these tables. In that event, the corresponding ERATentries may be affected. Therefore, whenever the segment table or pagetable are modified, an appropriate message will be broadcast to allprocessors on the bus, so that each may invalidate any affected ERATentry. If, however, a processor is in a different logical partition, itsERAT is not affected by such a change. By comparing the LPID in the bustag with the processor's own LPID in its configuration register, theprocessor knows immediately (e.g., at the bus interface 225, withoutaccessing ERAT 301) whether the bus message pertains to it, and cansafely ignore any page table or segment table changes in for differentlogical partition.

The ability of code in hypervisor state to alter the information inconfiguration register 910 means that the logical partitioning of asystem can be dynamically changed. E.g., processors and other resourcescan be re-allocated to different logical partitions, the address rangesassociated with a logical partition can be altered, or partitioning canbe turned off entirely. Since only code executing in hypervisor statecan alter these registers, the system is protected from accidentalre-configuration by user code.

Additional background information concerning an exemplary (although byno means the only possible) hypervisor implementation can be found incommonly assigned copending U.S. patent application Ser. No. 09/314,214,filed May 19, 1999, entitled Logical Partition Manager and Method,herein incorporated by reference.

It will be understood that certain logic circuitry not essential to anunderstanding of the present invention has been omitted from thedrawings and description herein for clarity. For example, logic formaintaining the MRU bit in array 302, logic for detecting parity errorsand taking appropriate corrective action, etc., have been omitted.

In the preferred embodiment, a multithreaded processor employingcoarse-grained hardware multithreading concepts is used. However, itwill be understood that as alternative embodiments it would be possibleto employ fine-grained multithreading operation, in which executionamong the various threads is rotated on a cycle-by-cycle basis. It wouldalso be possible to support logical partitioning as described herein ona processor which does not have hardware multithreading support.

While the invention has been described in connection with what iscurrently considered the most practical and preferred embodiments, it isto be understood that the invention is not limited to the disclosedembodiments, but on the contrary, is intended to cover variousmodifications and equivalent arrangements included within the spirit andscope of the appended claims.

What is claimed is:
 1. A computer processing apparatus for supporting acomputer system divisible into a plurality of logical partitions, eachpartition having a respective portion of the real address space of saidcomputer system, said computer processing apparatus comprising:effective address generating logic, said effective address generatinglogic generating effective addresses to be accessed, wherein at leastsome of said effective addresses generated by said effective addressgenerating logic are base real addresses; at least one state registerfor recording processor operating parameters, said at least one stateregister including a mode designator, said mode designator designatingan operating mode; real address partitioning logic, said real addresspartitioning logic modifying one or more high order bits of said basereal address to generate a partitioned real address when said base realaddress is associated with a first operating mode, said partitioned realaddress lying within the portion of the real address space of saidcomputer system of a logical partition associated with said computerprocessing apparatus, and said real address partitioning logic notmodifying said one or more high order bits of said base real addresswhen said base real address is associated with a second operating mode.2. The computer processing apparatus of claim 1, further comprising:real address range checking logic, said real address range checkinglogic generating an error signal responsive to detecting a base realaddress outside a predetermined range when said base real address isassociated with said first operating mode, and not generating an errorsignal responsive to detecting a base real address outside apredetermined range when said base real address is associated with saidsecond operating mode.
 3. The computer processing apparatus of claim 1,wherein at least some of said effective addresses generated by saideffective address generating logic are translatable addresses intendedfor translation from an effective address to a real address; and whereinsaid computer processing apparatus further comprises real addressselection logic for selectively outputting a real address translatedfrom said effective address when said effective address is atranslatable address, and outputting a real address generated by saidreal address partitioning logic when said effective address is a basereal address.
 4. The computer processing apparatus of claim 3, furthercomprising: an effective-to-real address translation table, wherein atleast some of said effective addresses which are translatable addressesare translated from an effective address to a real address by referenceto said effective-to-real address translation table.
 5. The computerprocessing apparatus of claim 1, further comprising: a plurality of setsof registers for supporting the execution of a plurality of threads,each set of registers corresponding to a respective one of saidplurality of threads; wherein said at least one state register forrecording processor operating parameters comprises a respective modedesignator associated with each thread, said mode designatordesignating, for each of said threads independently, a respectiveoperating mode; and wherein said real address partitioning logicmodifies one or more high order bits of said base real address togenerate a partitioned real address when said base real address isgenerated on behalf of a thread in said first operating mode, and doesnot modify said one or more high order bits of said base real addresswhen said base real address is generated on behalf of a thread in saidsecond operating mode.
 6. The computer processing apparatus of claim 5,further comprising: real address range checking logic, said real addressrange checking logic generating an error signal responsive to detectinga base real address outside a predetermined range when said base realaddress is generated on behalf of a thread in said first operating mode,and not generating an error signal responsive to detecting a base realaddress outside a predetermined range when said base real address isgenerated on behalf of a thread in said second operating mode.
 7. Thecomputer processing apparatus of claim 5, wherein said effective addressgenerating logic comprises an instruction unit for generating effectiveaddresses of instructions for execution by said computer processingapparatus, said instruction unit generating effective addresses onbehalf of an active thread and on behalf of at least one dormant thread,said real address partitioning logic selectively modifying one or morehigh order bits of said base real address to generate a partitioned realaddress on behalf of an active thread and on behalf of at least onedormant thread responsive to said mode designator associated with therespective thread.
 8. The computer processing apparatus of claim 5,wherein said mode designator is placed in said second operating modeonly upon occurrence of one of a set of predefined events, each saidpredefined event of said set of predefined events causing saidprocessing unit to branch to a respective predefined real memoryaddress.
 9. The computer processing apparatus of claim 8, wherein astate represented by said at least one state register is saved in asaved state register upon occurrence of one of said set of predefinedevents, and restored to said at least one state register upon returnfrom processing said one of said set of predefined events.
 10. Thecomputer processing apparatus of claim 2, wherein said real addressrange checking logic further comprises: a real memory limit registerspecifying a range of address bits of said effective address; AND logicperforming a plurality of logical ANDs of each of a plurality of addressbits derived from said effective address generated by effective addressgeneration logic with a respective bit from a mask generated from avalue in said real memory limit register to produce a masked portion ofsaid effective address; and OR logic for performing a logical OR of aplurality of address bits derived from said effective address generatedby said effective address generation logic, said plurality of addressbits derived from said effective address including said masked portionof said effective address generated by said effective address generationlogic.
 11. The computer processing apparatus of claim 1, wherein saidreal address partitioning logic comprises: a real memory offset registercontaining a plurality of address bits defining a logical addresspartition; and OR logic performing a plurality of logical ORs of each ofa plurality of address bits derived from said effective addressgenerated by said effective address generating logic with a respectivebit from said real memory offset register.
 12. The computer processingapparatus of claim 1, wherein said mode designator is placed in saidsecond operating mode only upon occurrence of one of a set of predefinedevents.
 13. The computer processing apparatus of claim 12, wherein eachsaid predefined event of said set of predefined events causes saidprocessing unit to branch to a respective predefined real memoryaddress.
 14. The computer processing apparatus of claim 12, wherein astate represented by said at least one state register is saved in asaved state register upon occurrence of one of said set of predefinedevents, and restored to said at least one state register upon returnfrom processing said one of said set of predefined events.
 15. Acomputer processing apparatus for supporting a computer system divisibleinto a plurality of logical partitions, each partition having arespective portion of the real address space of said computer system,said computer processing apparatus comprising: means for maintainingstate information for at least one thread; means for generatingeffective addresses for said at least one thread, wherein at least someof said effective addresses are base real addresses not intended fortranslation; means for enforcing logical partitioning of said base realaddresses not intended for translation, wherein said means for enforcinglogical partitioning generates partitioned real addresses from said basereal addresses responsive to said state information, said partitionedreal addresses lying within the portion of said real address space ofsaid computer system of a logical partition associated with saidcomputer processing apparatus.
 16. The computer processing apparatus ofclaim 15, further comprising: a plurality of sets of registers forsupporting the execution of a plurality of threads, each set ofregisters corresponding to a respective one of said plurality ofthreads; wherein said means for maintaining state information maintainsstate information for each of said plurality of threads independently;wherein said means for enforcing logical partitioning of said base realaddresses not intended for translation generates partitioned realaddresses from said base real addresses responsive to state informationfor the thread associated with said base real address.